package com.hwg.emp.dao;

import java.util.HashMap;
import java.util.Map;

import com.hwg.emp.dao.impl.DeptDAOImpl;
import com.hwg.emp.dao.impl.EmployeeDAOImpl;
import com.hwg.emp.dao.impl.AskoffDAOImpl;
import com.hwg.emp.dao.impl.AttendanceDAOImpl;
import com.hwg.emp.dao.impl.ModuleDAOImpl;
import com.hwg.emp.dao.impl.OvertimeDAOImpl;
import com.hwg.emp.dao.impl.RoleDAOImpl;
import com.hwg.emp.dao.impl.UserDAOImpl;

public class DaoFactory {

	private static final Map<Class, Object> DAOS_MAP = new HashMap<Class, Object>();

	static{
		init();
	}
	
	private static void init() {
		DAOS_MAP.put(UserDAO.class, new UserDAOImpl());
		DAOS_MAP.put(RoleDAO.class, new RoleDAOImpl());
		DAOS_MAP.put(ModuleDAO.class, new ModuleDAOImpl());
		DAOS_MAP.put(EmployeeDAO.class, new EmployeeDAOImpl());
		DAOS_MAP.put(DeptDAO.class, new DeptDAOImpl());
		DAOS_MAP.put(OvertimeDAO.class, new OvertimeDAOImpl());
		DAOS_MAP.put(AskoffDAO.class, new AskoffDAOImpl());
		DAOS_MAP.put(AttendanceDAO.class, new AttendanceDAOImpl());
	}

	public static <T> T getDao(Class<T> type) {
		return (T) DAOS_MAP.get(type);
	}
	
}
